<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="lib/js/vue.js" type="text/javascript" charset="utf-8"></script>

    <!--this.$http 挂载了-->
    <script src="lib/js/vue-resource.js" type="text/javascript"></script>

</head>
<body>
<div id="app">
    <input type="button" value="get请求" @click="geto">
    <hr>
    <input type="button" value="post请求" @click="posto">


</div>
<script>
    // 创建一个vue实例
    Vue.http.options.root = 'http://www.liulongbin.top:3005'

    new Vue({
        el:'#app',
        data:{
            msg:'信息'
        },
        methods:{
            geto() {
                this.$http.get('api/getlunbo').then(function (result) {
                    console.log(result.data)
                })

            },
            posto() {
                this.$http.post('http://kerys.pythonanywhere.com/api/addprod/', {name: '品牌名称'} ,{emulateJSON:true}).then(function (result) {
                    console.log(result)
                })
            }


        }
    })
</script>
</body>
</html>
